var endorsements = new Array;

endorsements.push(["Fantastic interview. It should be required reading for everyone!", "<a href=\"http://www.commonsenserunswild.typepad.com/\">Janette Stripling</a>"]);
endorsements.push(["For the record, I came up with my column all on my own.  I didn't even know that yours existed, but now I'll keep an eye on it for what not to steal.", "<a href=\"http://www.pbs.org/cringely/\">Robert X. Cringely</a>"]);
endorsements.push(["I'd rather give my money to you than your average run-of-the-mill panhandler. They smell like alcohol and urine. You stink of wit; much better.", "Kelly Pearson"]);
endorsements.push(["I'll check out your site often.", "<a href=\"http://www.foxnews.com/strakalogue/index.html\">Mike Straka</a>"]);
endorsements.push(["I'm only half way through the interview and I can't believe how good it is....", "Loren Porter"]);
endorsements.push(["If you click just one link today, make it this one. You won't be disappointed.", "<a href=\"http://www.nationalcenter.org/2004/12/in-red-zone-iraq-as-youve-never-read.html\">Amy Ridenour</a>"]);
endorsements.push(["Incidentally, if you decide to click around the rest of Jeff's website, I'd recommend that you not be too taken in by all the forgery blogging. As far as I can tell, the right wing's latest conspiracy theory is essentially without foundation.", "<a href=\"http://backwardscity.blogspot.com/2004/09/zork-as-life.html\">Gerry Canavan</a>"]);
endorsements.push(["Jeff Harrell expertly breaks down the Herbie series and why Disney is ruining it. And if that doesn't fit your fancy, there's always the series of Lohan-themed photo links in his introduction to chew on.", "<a href=\"http://www.filmrot.com/articles/news/005644.php\">Mediamelt</a>"]);
endorsements.push(["Jeff Harrell’s Shape of Days blog was nine days ahead of the big media in looking at the Selectric Composer and realizing that it couldn't have produced the RatherGate documents.", "<a href=\"http://instapundit.com\">Glenn Reynolds</a>"]);
endorsements.push(["Jeff Harrell, you are a Golden God!!", "<a href=\"http://www.sundriesshack.com/\">Jimmie Bise, Jr.</a>"]);
endorsements.push(["Keep up the GREAT work.", "<a href=\"http://michellemalkin.com\">Michelle Malkin</a>"]);
endorsements.push(["Thanks for all your efforts on your Survivor series, Jeff. It's truly been a pleasure. I'm gonna miss them. They're so much better than the usual crap you wri....erm, I mean, you've done an excellent job with them.", "<a href=\"http://texasnative.com/weblog/blogger.html\">Boyd Garrett</a>"])
endorsements.push(["The excellent blog Shape of Days vehemently disagrees with me on this one. Be sure to read why.", "<a href=\"http://www.captainsquartersblog.com/mt\">Ed Morrissey</a>"]);
endorsements.push(["The place the media hasn't paid much attention to for some reason, the place where I think the most interesting discourse and opinion is going on, and the place where I'm now going to include on my list of RSS feeds, Shape of Days, run by Jeff Harrell, self-proclaimed \"Freelance Opinion Writer.\"", "<a href=\"http://www.rizzn.com/2004/09/this-is-gods-way-of-teaching-people.php\">Mark Hopkins</a>"]);
endorsements.push(["Your Survivor recaps have made my day. I am inspired enought to open up a PayPal account just to be able to contribute to this brilliant ongoing commentary on my favorite television programe.", "<a href=\"http://soleio.com\">Oswald Cuervo</a>"]);
endorsements.push(["Your blog is better written than just about any blog I have ever read.", "<a href=\"http://www.shapeofdays.com/2005/03/the_oilforfood_.html#c4641560\">Boyd in Tennessee</a>"]);
endorsements.push(["Your computer has too much computer in it and not enough typewriter.", "<a href=\"http://homestarrunner.com/sbemail34.html\">Strong Bad</a>"]);
endorsements.push(["Some things are more important than politics!", "<a href=\"http://talkleft.com\">Jeralyn Merritt</a>"]);
endorsements.push(["Do I have to ban you entirely?  I will.  I don't have time for this.", "<a href=\"http://talkleft.com\">Jeralyn Merritt</a>"]);
endorsements.push(["What extra-special brand of scribal Tourette's is required to author a screed like this?", "<a href=\"http://indcjournal.com\">Bill Ardolino</a>"]);
endorsements.push(["I may have to go back on my declaration that the lefties exlusively dominate the blogosphere's nasty discourse, as avowed righty Harrell's piece — in both its rhetorical style and illogical, absolutist, moonbat reasoning — is one of the most oddly harsh things I've read in quite some time.", "<a href=\"http://indcjournal.com\">Bill Ardolino</a>"]);
endorsements.push(["Unemployed people like you shouldn't even vote.", "Andrae Palmer"]);
endorsements.push(["You are the darn immigrant, not me. You do not have any respect at all for the original inhabitants of this continent. Thus you don't even deserve to live anywhere in this continent. They should deport you to North Korea, because there is where you really belong, not in North America. And I do speak for the vast majority of my fellow Canadians who think exactly the very same about America as I do.", "Joseph Mateus"]);
endorsements.push(["Jeff, you are swimming in a deep and lonely sea. What the fuck is wrong with you?", "Bruce Castleberry"]);
endorsements.push(["No more pecker shots. I’m still trying to explain blogs to my friends.", "Hugh Slatery"]);
endorsements.push(["You look totally cute and fuckable!", "<a href=\"http://moxie.nu/blog.php\">Moxie</a>"]);
/* endorsements.push(["I’m a long-time reader of yours. The phrase “jacks my sh*t” makes me chuckle almost every time I read it and I would undoubtedly steal it away for my repertoire were it not for the fact that it would totally jack the sh*t of my Christian, conservative bosses. Hee hee.", "Mary Katherine Ham"]); */
endorsements.push(["Hey … NICE WORK, man!", "Chris Muir"]);
endorsements.push(["I spent all of my working life as an editor and writer of expository prose, and there is damn little good writing out there, I’m afraid. Thanks to you for a well-written essay which expresses opinions I totally agree with, probably better than I could at this point.", "Marianne Matthews"]);
endorsements.push(["I’m halfway thru <a href=\"http://www.theshapeofdays.com/2005/11/a_notexactlybri.html\">this unnameable horror thing</a>, and like, I have no idea what you are talking about, but I fucking love it.", "Amy Poller"]);

run();

function run() {
  var oldOnload = window.onload;
  if (typeof window.onload != "function") {
    window.onload = thisOnload;
  } else {
    window.onload = function() {
      oldOnload();
      thisOnload();
    }
  }
}

function thisOnload() {
  bendOverBackwardsForIE();
  addMattesAndShadows();
  assignPictSizes();
}

function bendOverBackwardsForIE() {
  var ua = navigator.userAgent.toLowerCase();
  var isIE = (ua.indexOf('msie') != -1 && (ua.indexOf('opera') == -1) && (ua.indexOf('webtv') == -1) );
  if (isIE) {

    /* Do that shitass PNG filter thing. Damn, I hate IE so much. */
    var imgs = document.getElementsByTagName('img');
    for (i = 0; i < imgs.length; i++ ) {
      var thisImg = imgs[i];
      if (thisImg.src.substring(thisImg.src.length-4, thisImg.src.length) == ".png") {
        thisImg.style.width = parseInt(thisImg.clientWidth) + "px";
        thisImg.style.height = parseInt(thisImg.clientHeight) + "px";
        var wackyFilterThing = "progid:DXImageTransform.Microsoft.AlphaImageLoader";
        wackyFilterThing += "(src='" + thisImg.src + "',";
        wackyFilterThing += "sizingMethod='scale')";
        thisImg.style.filter = wackyFilterThing;
        thisImg.src = "/css/images/spacer.gif";
      }
    }
    var inputs = document.getElementsByTagName('input');
    for (i = 0; i < inputs.length; i++) {
      var thisInput = inputs[i];
      if (thisInput.type == "image") {
        var wackyFilterThing = "progid:DXImageTransform.Microsoft.AlphaImageLoader";
        thisInput.style.width = parseInt(thisInput.clientWidth) + "px";
        thisInput.style.height = parseInt(thisInput.clientHeight) + "px";
        wackyFilterThing += "(src='" + thisInput.src + "',";
        wackyFilterThing += "sizingMethod='scale')";
        thisInput.style.filter = wackyFilterThing;
        thisInput.src = "/css/images/spacer.gif";
      }
    }
  }
}


function assignPictSizes() {
  var content = document.getElementById("frame");
  var divs = content.getElementsByTagName("div");
  for (i = 0; i < divs.length; i++ ) {
    var thisElem = divs[i];
    var isPict = false;
  
    if (thisElem.className) {
    
      /* Tokenize the className */
    
      var classTokens = thisElem.className.split(' ');
      var whichToken = 0;
      for (whichToken = 0; whichToken < classTokens.length; whichToken++) {
        if (classTokens[whichToken] == "pict")
          isPict = true;
      }
  
      if (isPict && ! thisElem.style.width) { /* allow for a manual override of the width */
 
        var newWidth = 0;
        var children = thisElem.childNodes;
        
        /* Find the widest of the children and set this element's width to that. */
        
        for (j = 0; j < children.length; j++) {
          if (children[j].clientWidth && 
          (children[j].tagName &&
            (children[j].tagName.toLowerCase() != "p" && children[j].tagName.toLowerCase() != "h4")) &&
          children[j].clientWidth > newWidth) {
            newWidth = children[j].clientWidth;
          }
        }
        thisElem.style.width = newWidth + "px";
      }

    }
  }
}

function addMattesAndShadows() {
  if(!document.getElementById || !document.createElement)
    return(false);
  var elements=document.getElementsByTagName("img");
  for ( i=0; i < elements.length; i++){
    var isShadow = false;
    var extraWidth = 10;
    var extraHeight = 14;
    var thisElem=elements[i];
    
    if (thisElem.className) {
    
      /* Tokenize the className */

      var classTokens = thisElem.className.split(' ');
      var whichToken = 0;
      for (whichToken = 0; whichToken < classTokens.length; whichToken++) {
        if (classTokens[whichToken] == "shadow")
          isShadow = true;
        if (classTokens[whichToken] == "nomatte")
          extraWidth = 0;
      }
      
      /* If this is a shadow object, create the necessary elements and insert them into the DOM tree. */

      if (isShadow) {
        var shadowDiv = document.createElement('div');
        shadowDiv.className = 'shadow';
        shadowDiv.style.width = (thisElem.width + extraWidth) + "px";
        shadowDiv.style.height = (thisElem.height + extraHeight) + "px";
        shadowDiv.appendChild(thisElem.cloneNode(true));
        var topleft = document.createElement('div');
        topleft.className="topleft";
        shadowDiv.appendChild(topleft);
        var topright = document.createElement('div');
        topright.className="topright";
        shadowDiv.appendChild(topright);
        var bottomleft = document.createElement('div');
        bottomleft.className="bottomleft";
        shadowDiv.appendChild(bottomleft);        
        var bottomright = document.createElement('div');
        bottomright.className="bottomright";
        shadowDiv.appendChild(bottomright);
        thisElem.parentNode.replaceChild(shadowDiv, thisElem);
      }
      
    }
  }
}
